function str = SplineToString( S )
N = size(S, 2);
str = '';
x = sym('x');
fileId = fopen('lab6report.txt', 'w');
for i = 1 : N
    p = sprintf('%.4f + %.4f * (x - %.4f) + %.4f * (x - %.4f)^2 + %.4f * (x - %.4f)^3', ...
        S(i).a, S(i).b, S(i).xp, S(i).c, S(i).xp, S(i).d, S(i).xp); 
    p = simplify(sym(p));
    interval = sprintf(',\t%f < x < %f' ,S(i).xp, S(i).xi);
    str = strcat(char(p), interval);
    fprintf(fileId, '%s\n', str);
end;
fclose(fileId);


end

